<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="javax.naming.*,javax.sql.*,java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>FirstJndi</title>
</head>
<body>
JNDI
<hr>
<%
	
	Context initc = new InitialContext();
	DataSource ds = (DataSource)initc.lookup("java:/comp/env/jdbc/ds_mysql");
	Connection conn  = ds.getConnection();
	Statement s = conn.createStatement();
	ResultSet rs = s.executeQuery("select * from jndi01_dept");
	while(rs.next()){
		%>
		<%=rs.getString("name") %>
		<%
	}
	
%>
</body>
</html>